#!/bin/sh
case "$1" in
  start)
    (
      # This takes a half-second or so to start, so wait in the background
      # in order to speed up booting.
      wait-until-created /var/run/gpio-mailbox
      babysit 5 sysmgr --interval 15000 --hdd_temp_interval 30000 2>&1 \
        | logos sysmgr &
    ) &
    ;;
  stop)
    pkillwait -x sysmgr
    ;;
  restart)
    $0 stop; $0 start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    ;;
esac
